//
//  BasicTableViewController.swift
//  weibo飞飞
//
//  Created by 田侠飞 on 16/6/25.
//  Copyright © 2016年 田侠飞. All rights reserved.
//

import UIKit

class BasicTableViewController: UITableViewController {
 //设置登录和注册页面(每个界面都不一样 我们建一个基类,然后每一个子控制器都继承这个基类)
    
    //判断是否登录过
    
    let  isLogin : Bool  =  TXFUserAccountTools.sharedTools.isLogin
    var  basicView : TXFBasicView?
    override func loadView() {
        if isLogin{
        //登录过:
            
            super.loadView()
   
        } else {
        //没登录过:
        
        setUpBasicView()
        
        }
       
    }
    private func setUpBasicView(){
        setUpNav()
        basicView = TXFBasicView()
        
        basicView?.closure =  { [weak self] in
        
     
            
        self?.loginClick()
      
        
        }
        
        view = basicView
        
        }
    
        func setUpNav(){
        
        
            
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "确定", style: UIBarButtonItemStyle.Plain, target: self, action: "loginClick")
            
          navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "loginClick")
        
        
        }
        
        
       func loginClick(){
        
       //跳转到控制器
        let oauthVC = TXFOAuthViewController()
        let nav = UINavigationController(rootViewController: oauthVC)
        
        presentViewController(nav, animated: true, completion: nil)
        
        
    
        
        
        }


    
    
override func viewDidLoad() {
    super.viewDidLoad()
    
}


}
